package com.hadwinling.control;

import com.hadwinling.service.UserService;
import com.hadwinling.util.PhoneUtil;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.aliyuncs.exceptions.ClientException;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Controller
public class SendSmsControl {
	@Autowired
	private UserService userService;

	@RequestMapping(value = "/user/resetSend.action",method = RequestMethod.GET)
	public void resetSend(String tel,HttpServletRequest request, HttpServletResponse response) throws IOException, ClientException
			 {

		//根据获取到的手机号发送验证码
//		String code = GetMessageCode.getCode(tel);
		//生成验证码
		String code = PhoneUtil.creatRandom();
		//发送验证码
		PhoneUtil.sendSms(tel,code);
		response.getWriter().print(code);

	}

}
